<?php
/**
 * Rechnungen-einfach
 *
 * @license    http://www.gnu.org/licenses/gpl.html     GNU GPL v3
 */

final class Version
{
    /**
     * Zend Framework version identification - see compareVersion()
     */
    const VERSION = '1.0.1';

    /**
     * The latest stable version Rechnungen-einfach available
     *
     * @var string
     */
    protected static $_latestVersion;

    /**
     * Compare the specified Rechnungen-einfach version string $version
     * with the current Version::VERSION of Rechnungen-einfach.
     *
     * @param  string  $version  A version string (e.g. "0.7.1").
     * @return int           -1 if the $version is older,
     *                           0 if they are the same,
     *                           and +1 if $version is newer.
     *
     */
    public static function compareVersion($version)
    {
        $version = strtolower($version);
        $version = preg_replace('/(\d)pr(\d?)/', '$1a$2', $version);
        return version_compare($version, strtolower(self::VERSION));
    }
}
